package com.chenfan.mcn.dao;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chenfan.common.extension.mybatisplus.enhanced.EnhancedBaseMapper;
import com.chenfan.mcn.model.McnPage;
import com.chenfan.mcn.model.PurchaseContract;
import com.chenfan.mcn.model.dto.PurchaseContractSearchDTO;
import com.chenfan.mcn.model.vo.AssociatedPurchase;
import com.chenfan.mcn.model.vo.PurchaseContractVO;
import com.chenfan.mcn.model.vo.PurchaseSimpleVO;
import com.chenfan.mcn.model.vo.PurchaseVO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author lizhejin
 * @since 2021-02-26
 */
public interface PurchaseContractMapper extends EnhancedBaseMapper<PurchaseContract> {

    /**
     * 查询指定收入合同下关联的采购合同单号
     *
     * @param incomeContractCode {@link String}
     * @return {@link List}
     */
    List<PurchaseSimpleVO> getPurchaseByContract(@Param("incomeContractCode") String incomeContractCode);

    /**
     * 详情
     *
     * @param id        {@link Long}
     * @param processId {@link Long}
     * @return {@link PurchaseContractVO}
     */
    PurchaseContractVO info(Long id, long processId);

    /**
     * 分页数据
     *
     * @param page                      {@link McnPage}
     * @param purchaseContractSearchDTO {@link PurchaseContractSearchDTO}
     * @return
     */
    Page<PurchaseVO> getList(McnPage<PurchaseVO> page, @Param("dto") PurchaseContractSearchDTO purchaseContractSearchDTO);

    /**
     * 导出表格
     *
     * @param purchaseContractSearchDTO {@link PurchaseContractSearchDTO}
     * @return {@link List}
     */
    List<PurchaseVO> exportExcel(@Param("dto") PurchaseContractSearchDTO purchaseContractSearchDTO);

    /**
     * 获取执行单计算分成关联的采购合同
     *
     * @param contractCode 收入合同编号
     * @return 采购合同
     */
    List<AssociatedPurchase> getPurchaseContract(String contractCode);

    /**
     * 获取执行单关联的采购单号
     *
     * @param contractCode 执行单单号
     * @return 采购单号
     */
    String getPurchaseContractCode(String contractCode);
}
